<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org">
<meta charset="utf-8">
<head th:include="include :: header"></head>
<body class="gray-bg">
<div class="wrapper wrapper-content ">
	<div class="row">
		<div class="col-sm-12">
			<div class="ibox float-e-margins">
				<div class="ibox-content">
					<form class="form-horizontal m-t" id="signupForm">
						<input id="procedureLinkId" name="procedureLinkId" th:value="${procedureLink.procedureLinkId}"  type="hidden">

						<div class="form-group">
							<label class="col-sm-3 control-label">环节类型：</label>
							<div class="col-sm-8">
								<label class="radio-inline">
									<input type="radio" name="type" disabled th:checked="${procedureLink.type == 0} ? true : false" value="0" /> 一级环节
								</label>
								<label class="radio-inline">
									<input type="radio" name="type" disabled th:checked="${procedureLink.type == 1} ? true : false" value="1" /> 二级环节
								</label>
							</div>
						</div>
						<div class="form-group">
							<label class="col-sm-3 control-label">上级环节：</label>
							<div class="col-sm-8">
								<select id="parentId" name="parentId" class="form-control">
									<!--<option value="0">根环节</option>-->
								</select>
								<!--<input id="" name="" class="form-control" type="text"
                                       th:value="${pName}" readonly>-->
							</div>
						</div>
						<div class="form-group">
							<label class="col-sm-3 control-label">溯源环节名称：</label>
							<div class="col-sm-8">
								<input id="procedureLinkName" name="procedureLinkName" th:value="${procedureLink.procedureLinkName}" class="form-control" type="text">
							</div>
						</div>

						<!--<div class="form-group">-->
							<!--<label class="col-sm-3 control-label">默认值：</label>-->
							<!--<div class="col-sm-8">-->
								<!--<input id="defaultValue" name="defaultValue" th:value="${procedureLink.defaultValue}" class="form-control" type="text">-->
							<!--</div>-->
						<!--</div>-->
						<div style="display: none" class="form-group">
							<label class="col-sm-3 control-label">图标：</label>
							<div class="col-sm-8">
								<input id="iconFile" name="iconFile" th:value="${procedureLink.icon}" class="form-control" type="file">
							</div>
						</div>
						<div class="form-group">
							<label class="col-sm-3 control-label">排序：</label>
							<div class="col-sm-8">
								<input id="sort" name="sort" th:value="${procedureLink.sort}" placeholder="数值越小越靠前" class="form-control" type="text">
							</div>
						</div>
						<div style="display: none" class="form-group">
							<label class="col-sm-3 control-label">是否显示查询：</label>
							<div class="col-sm-8">
								<select id="isView" name="isView" th:value="${procedureLink.isView}" class="form-control" >

								</select>
							</div>
						</div>
                        <div style="display: none" id="rep" class="form-group">
                            <label class="col-sm-3 control-label">是否可重复录入：</label>
                            <div class="col-sm-8">
                                <select id="isRepeat" name="isRepeat" class="form-control">
                                    <option value="1">是</option>
                                    <option value="0" selected>否</option>
                                </select>
                            </div>
                        </div>

						<!--<div class="form-group">
							<label class="col-sm-3 control-label">是否显示查询：</label>
							<div class="col-sm-8">
								<select id="isRepeat" name="isRepeat" class="form-control" >
									<option  th:selected = "${procedureLink.isRepeat}==1"  value="1"> 是 </option>
									<option  th:selected = "${procedureLink.isRepeat}==0" value="0">否 </option>
								</select>
							</div>
						</div>-->

						<div class="form-group">
							<label class="col-sm-3 control-label">模板：</label>
							<div class="col-sm-8">
								<select id="procedureId" name="proceduresId"  class="form-control">

								</select>
							</div>
						</div>
						<div class="form-group">
							<div class="col-sm-8 col-sm-offset-3">
								<button type="submit" class="btn btn-primary">提交</button>
								<input type="button" class="btn btn-danger" value="取消"
									   onclick="javascript:
											var index = parent.layer.getFrameIndex(window.name); // 获取窗口索引
				                            parent.layer.close(index);">
								</input>
							</div>
						</div>
					</form>
				</div>
			</div>
		</div>
	</div>
</div>
<div th:include="include::footer"></div>
<script type="text/javascript" th:inline="javascript">
	//初始化数据
	function initDate(){
		if ($('input[name="type"][value="0"]').prop("checked")) {
			$("#parentId").empty();
			$("#parentId").append(new Option("根目录", 0 , false, true));
            $("#rep").fadeOut();
		}else {
			$("#parentId").empty();
			var url = ctx + "/procedures/procedureLink/first/"+[[${procedureLink.proceduresId}]];
			$.get(url,{},function (data) {
				$.each(data,function(index,val){
					$("#parentId").append(new Option(val.procedureLinkName, val.procedureLinkId, false, [[${procedureLink.parentId}]]==val.procedureLinkId));
				});
			});
            $("#rep").fadeIn();
		}
	}

	$('input[name="type"]').change(function () {
		initDate()
	})

	function getProceduresId() {
		var id =[[${procedureLink.proceduresId}]]
		return id;
	}

	function isView(){
		var isView =[[${procedureLink.isView}]]
		if (isView == 0){
			$("#isView").append("<option  value='1'>是 </option>");
			$("#isView").append("<option selected = 'selected'  value='0'>否 </option>");
		}else{
			$("#isView").append("<option selected = 'selected' value='1'>是 </option>");
			$("#isView").append("<option  value='0'>否 </option>");
		}
	}
</script>
<script type="text/javascript" th:src="@{/js/appjs/procedures/procedureLink/edit.js}" src="/js/appjs/procedures/procedureLink/edit.js">
</script>
</body>
</html>
